from __future__ import annotations

import arcade


SCREEN_WIDTH=600
SCREEN_HEIGHT=600


class GameView(arcade.View):

    def __init__(self, window = None, background_color = None):
        self.score_text=arcade.Text(
            'hello,world',
            0,
            0,
            color=arcade.color.WHITE,
            font_size=16,
            anchor_x='left',
            anchor_y='bottom'
        )

    def on_draw(self):
        self.score_text.draw()

    def update_score(self, score):
        self.score_text.text = f'score: {score}'

def main():
    arcade.open_window(SCREEN_WIDTH, SCREEN_HEIGHT, '显示文本')
    arcade.set_background_color(arcade.color.BLACK)

    game_view = GameView()
    # arcade.set_viewport(0, SCREEN_WIDTH, 0, SCREEN_HEIGHT)
    arcade.start_render()
    game_view.on_draw()
    arcade.finish_render()
    arcade.run()

if __name__=='__main__':
    main()